package org.note.law.module.law;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface LawCodeDAO extends JpaRepositoryImplementation<LawCode, String> {
    List<LawCode> findByCodeName(String codeName);
    List<LawCode> findByCodeNameAndCodeVersion(String codeName, String codeVersion);
    @Query("select new org.note.law.module.law.LawCode(t.id,t.codeCover, t.codeName, t.codeDesc, t.codeVersion, t.createUserId, t.modifyUserId, t.createdTime, t.updatedTime) from LawCode t")
    Page<LawCode> findAllIgnoreFile(Pageable pageable);

    @Query("select new org.note.law.module.law.LawCode(t.id,t.codeCover, t.codeName, t.codeDesc, t.codeVersion, t.createUserId, t.modifyUserId, t.createdTime, t.updatedTime) from LawCode t where t.codeName like %:key% or t.codeDesc like %:key%")
    Page<LawCode> findAllMatcher(Pageable pageable,@Param("key") String key);



}
